/*
 * NewJFrame.java
 *
 * Created on 16 mars 2005, 14:18
 */

package tini;

/**
 *
 * @author  raph
 */
public class NewJFrame extends javax.swing.JFrame {
    private java.net.Socket s;
    /** Creates new form NewJFrame */
    public NewJFrame() {
        
        initComponents();
        try {
            s=new java.net.Socket("192.168.2.13",3333);
            System.out.println(s);
        }
        catch(java.io.IOException e){System.out.println("erreur ouverture socket");}
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    private void initComponents() {//GEN-BEGIN:initComponents
        jSlider1 = new javax.swing.JSlider();
        jTextField1 = new javax.swing.JTextField();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Stepper V0.0");
        jSlider1.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                NewJFrame.this.stateChanged(evt);
            }
        });

        getContentPane().add(jSlider1, java.awt.BorderLayout.CENTER);

        jTextField1.setText("jTextField1");
        getContentPane().add(jTextField1, java.awt.BorderLayout.NORTH);

        pack();
    }//GEN-END:initComponents

    private void stateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_stateChanged
        // TODO add your handling code here:
                jTextField1.setText(Integer.toString(jSlider1.getValue()));
                try {
            s.getOutputStream().write(jSlider1.getValue());
            
        }
        catch(java.io.IOException e){System.out.println("erreur ecriture socket");}

    }//GEN-LAST:event_stateChanged
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new NewJFrame().setVisible(true);
            }
        });
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JSlider jSlider1;
    private javax.swing.JTextField jTextField1;
    // End of variables declaration//GEN-END:variables
    
}
